<template>
  <div>
    <el-menu :default-active="activiting" @select="selectMenu">
      <el-submenu v-for="(item,index) in menus" :key="index" :index="item.name">
        <template slot="title">
          <i class="el-icon-setting"></i>
          <span slot="title">{{ item.title }}</span>
        </template>
        <el-menu-item v-for="(m,i) in item.children" :key="i" :index="m.name">
          <i class="el-icon-menu"></i>
          <span slot="title">{{m.title}}</span>
        </el-menu-item>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: 'eyMenu',
  methods: {
    selectMenu: function (index, indexPath, s) {
      this.$store.commit('addTab', index)
    }
  },
  computed: {
    activiting: {
      get: function () {
        return this.$store.state.activiting
      },
      set: function (newValue) {
        this.$store.commit('changeActivite', newValue)
      }
    },
    menus: function () {
      return this.$store.state.menus
    }
  }
}
</script>

<style scoped>
</style>
